Skip to content

docs: translate composition api #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 25, 2021
Merged

Conversation

naokie
Copy link
Member

@naokie naokie commented Nov 3, 2021

Description of Problem

API リファレンスの Composition API を翻訳します。
https://v3.ja.vuejs.org/api/composition-api.html

Proposed Solution

Additional Information

@naokie naokie changed the title Api/composition api docs: translate composition api Nov 3, 2021
@netlify
Copy link

netlify bot commented Nov 3, 2021

✔️ Deploy Preview for vuejs-v3-ja-doc-preview ready!

🔨 Explore the source changes: 019235c

🔍 Inspect the deploy log: https://app.netlify.com/sites/vuejs-v3-ja-doc-preview/deploys/619f5342c9777100088b46df

😎 Browse the preview: https://deploy-preview-557--vuejs-v3-ja-doc-preview.netlify.app

Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大変遅くなりました!
レビュー 👀 コメント 💬 しました。
確認お願いします!


- `{Data} props`
- `{SetupContext} context`

Similar to `this.$props` when using Options API, the `props` object will only contain explicitly declared props. Also, all declared prop keys will be present on the `props` object, regardless of whether it was passed by the parent component or not. Absent optional props will have a value of `undefined`.
オプション API を使うときの `this.$props` と同様に、`props` オブジェクトには明示的に宣言されたプロパティのみが含まれます。また、すべての宣言されたプロパティのキーは、親コンポーネントから渡されたかどうかに関わらず `props` オブジェクトに存在します。宣言されていない省略可能なプロパティは `undefined` という値になります。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Options API は Composition API の表記とバランスよくしたい (対比のケースだと気になる...) ので、Options API のママにしておきたいです。


- **Mapping between Options API Lifecycle Options and Composition API**
- **オプション API のライフサイクルオプションと Composition API のマッピング**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここの Options API の表記も同じく、そのままで。

function inject<T>(
key: InjectionKey<T> | string,
defaultValue: () => T,
treatDefaultAsFactory: true
): T
```

Vue provides an `InjectionKey` interface which is a generic type that extends `Symbol`. It can be used to sync the type of the injected value between the provider and the consumer:
Vue は `Symbol` を拡張したジェネリック型の `InjectionKey` インターフェイスを提供しています。これはプロバイダとコンシューマの間で注入された値の型を同期するために使用できます:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

providercosumer の訳も悩ましいですね...
個人的には、ソフトウェア用語としてよく出てくる技術word なので、そのままとしておきたいです。
訳すとしたら最初だけ訳スタイルの原文とカッコ付で訳スタイルが折り合い取れていい気がしています。

Suggested change
Vue は `Symbol` を拡張したジェネリック型の `InjectionKey` インターフェイスを提供しています。これはプロバイダとコンシューマの間で注入された値の型を同期するために使用できます:
Vue は `Symbol` を拡張したジェネリック型の `InjectionKey` インターフェイスを提供しています。これは provider (プロバイダ) と comsumer (コンシューマ) の間で注入された値の型を同期するために使用できます:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうですね、ドキュメント内でもここが初出で悩み、カタカナのままの判断にしました。

個人的には、ソフトウェア開発上の用語って、最近は英語のままが違和感なくなってきてますね。
一方で、初学者向けにもと考えたとき、正しい読み方を知ってもらう意味でも、カッコ書きのフォローいいですね。

Co-authored-by: kazuya kawaguchi <kawakazu80@gmail.com>
Co-authored-by: kazuya kawaguchi <kawakazu80@gmail.com>
@kazupon
Copy link
Member

kazupon commented Nov 25, 2021

LGTMです! 👍

@kazupon kazupon merged commit e93a155 into vuejs-jp:lang-ja Nov 25, 2021
@naokie naokie deleted the api/composition-api branch November 25, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants